#include <stdio.h> 
#include <unistd.h> 
#include <fcntl.h> 

int main(int argc, char **argv) {
    int fd = open("tmp", O_CREAT | O_TRUNC | O_WRONLY | O_DSYNC, 0666);
    if (fd < 0) {
        perror("open error");
        return -1;
    }

    off_t offset = lseek(fd, 1023, SEEK_SET);
    if (offset < 0) {
        perror("lseek error");
        return -1;
    }

    ssize_t ret = write(fd, "\0", 1);
    if (ret < 0) {
        perror("write error");
        return -1;
    }

    offset = lseek(fd, 0, SEEK_SET);
    if (offset < 0) {
        perror("lseek error");
        return -1;
    }

    int count = 10;
    while (count--) { 
        sleep(10);
        ret = write(fd, "11-", 1);
        if (ret < 0) {
            perror("write error");
            return -1;
        }
    }

    close(fd);
    return 0;
}
